package com.laboratory.controller;

import com.laboratory.domain.ResponseCode;
import com.laboratory.domain.ResponseResult;
import com.laboratory.domain.UserLogin;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {

    /**
     * MethodArgumentNotValidException （JSON参数校验失败）
     */
    @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResponseResult login(@Validated @RequestBody UserLogin userLogin) {
        return new ResponseResult(
                ResponseCode.LOGIN_SUCCESS,
                "登录成功",
                null
        );
    }

}
